<link rel="stylesheet" type="text/css" href="plugins/Goals/stylesheets/goals.css"/>
{% include "@Goals/_titleAndEvolutionGraph.twig" | raw %}

<div class="clear"></div>
{% if nb_conversions > 0 %}
    <h2>{{ 'Goals_ConversionsOverview'|translate }}</h2>
    <ul class="ulGoalTopElements">
        {% if ecommerce is not defined %}
            {% if topDimensions.country is defined %}
                <li>{{ 'Goals_BestCountries'|translate }} {% include '@Goals/_listTopDimension.twig' with {'topDimension':topDimensions.country} %}</li>
            {% endif %}
            {% if topDimensions.keyword is defined and topDimensions.keyword|length > 0 %}
                <li>{{ 'Goals_BestKeywords'|translate }} {% include '@Goals/_listTopDimension.twig' with {'topDimension':topDimensions.keyword} %}</li>
            {% endif %}
            {% if topDimensions.website is defined and topDimensions.website|length > 0 %}
                <li>{{ 'Goals_BestReferrers'|translate }} {% include '@Goals/_listTopDimension.twig' with {'topDimension':topDimensions.website} %}</li>
            {% endif %}
            <li>
                {{ 'Goals_ReturningVisitorsConversionRateIs'|translate("<strong>"~conversion_rate_returning~"</strong>")|raw }}
                , {{ 'Goals_NewVisitorsConversionRateIs'|translate("<strong>"~conversion_rate_new~"</strong>")|raw }}
            </li>
        {% else %}
            <li>
                {{ 'General_ColumnRevenue'|translate }}: {{ revenue|money(idSite)|raw -}}
                {% if revenue_subtotal is not empty %},
                    {{ 'General_Subtotal'|translate }}: {{ revenue_subtotal|money(idSite)|raw -}}
                {% endif %}
                {%- if revenue_tax is not empty -%},
                    {{ 'General_Tax'|translate }}: {{ revenue_tax|money(idSite)|raw -}}
                {% endif %}
                {%- if revenue_shipping is not empty -%},
                    {{ 'General_Shipping'|translate }}: {{ revenue_shipping|money(idSite)|raw -}}
                {% endif %}
                {%- if revenue_discount is not empty -%},
                    {{ 'General_Discount'|translate }}: {{ revenue_discount|money(idSite)|raw -}}
                {% endif %}
            </li>
        {% endif %}
    </ul>

    <a href="javascript:;" class="segmentedlog" onclick="SegmentedVisitorLog.show('Goals.getMetrics', 'visitConvertedGoalId=={{ idGoal }}', {})">
        {{ 'Live_RowActionTooltipWithDimension'|translate('General_Goal'|translate) }}
    </a>
{% endif %}

<script type="text/javascript">
    $(document).ready(function () {
        $('.goalTopElement').tooltip({
            track:   true,
            content: function () {
                return $(this).attr("title");
            },
            show: false,
            hide: false
        });
    });
</script>

{% if displayFullReport %}
    <h2 id='titleGoalsByDimension'>
        {% if idGoal is defined %}
            {{ 'Goals_GoalConversionsBy'|translate(goalName) }}
        {% else %}
            {{ 'Goals_ConversionsOverviewBy'|translate }}
        {% endif %}
    </h2>
    {% if nb_conversions > 0 or cart_nb_conversions is defined %}
        {{ goalReportsByDimension|raw }}
    {% else %}
        <p class="alert">{{ 'Goals_NoConversionsNoReportsMessage'|translate }}</p>
    {% endif %}
{% endif %}
